/* 全局样式重置与基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

body {
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding-top: 20px;
}

.container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 90%;
    max-width: 800px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

/* 视图容器样式 */
#view-container {
    background-color: #fff;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

/* 大厅视图样式 */
#lobby-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lobby-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.lobby-input-group label {
    font-weight: bold;
    color: #555;
}

.lobby-input-group input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
}

.lobby-input-group input:focus {
    border-color: #66afe9;
    box-shadow: 0 0 5px rgba(102, 175, 233, 0.5);
}

.lobby-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.lobby-buttons button {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.lobby-buttons button:hover {
    background-color: #45a049;
}

#create-room-btn {
    background-color: #2196F3;
}

#create-room-btn:hover {
    background-color: #0b7dda;
}

#join-room-btn {
    background-color: #ff9800;
}

#join-room-btn:hover {
    background-color: #f57c00;
}

#message-area {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    min-height: 40px;
    color: #333;
}

/* 房间视图样式 */
#room-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.room-info {
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.room-controls {
    display: flex;
    gap: 10px;
}

.room-controls button {
    padding: 8px 15px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.room-controls button:hover {
    background-color: #0b7dda;
}

#start-game-btn {
    background-color: #4CAF50;
}

#start-game-btn:hover {
    background-color: #45a049;
}

#leave-room-btn {
    background-color: #f44336;
}

#leave-room-btn:hover {
    background-color: #d32f2f;
}

.game-select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
}

/* 游戏视图通用样式 */
.game-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.game-controls button {
    padding: 8px 15px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.game-controls button:hover {
    background-color: #d32f2f;
}

/* 错误提示样式 */
.error {
    color: red;
    text-align: center;
    margin-top: 10px;
}

.tic-tac-toe-board {
  display: grid; /* 用 grid 布局快速实现 3x3 */
  grid-template-columns: repeat(3, 100px); /* 3 列，每列 100px */
  grid-template-rows: repeat(3, 100px); /* 3 行，每行 100px */
  gap: 2px; /* 单元格之间的间距 */
  margin: 20px auto; /* 居中显示 */
}

.tic-tac-toe-cell {
  width: 100px;
  height: 100px;
  border: 1px solid #333; /* 单元格边框（关键：让格子可见） */
  background-color: #fff;
  cursor: pointer; /* 鼠标悬浮时显示手型，提示可点击 */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px; /* 后续 X/O 的字体大小 */
}

.tic-tac-toe-cell:hover {
  background-color: #f0f0f0; /* 鼠标悬停效果 */
}

/* 帮助按钮样式 */
.help-button {
    background-color: #28a745 !important;
    border-radius: 20px !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.help-button:hover {
    background-color: #218838 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 房间操作按钮组 */
.room-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* 游戏操作按钮组 */
.game-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* 帮助弹窗样式 */
.help-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.help-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.help-modal-title {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 20px;
}

.help-modal-text {
    font-size: 1.1em;
    color: #666;
    line-height: 1.6;
    margin-bottom: 25px;
}

.help-modal-close {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.help-modal-close:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* 图片轮播样式 */
.help-modal-carousel {
    max-width: 800px;
}

.help-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    min-height: 400px;
}

.help-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    overflow: hidden;
}

.help-carousel-image {
    max-width: 100%;
    max-height: 600px;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.help-nav-btn {
    background: rgba(52, 152, 219, 0.8);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 15px;
    z-index: 10;
}

.help-nav-btn:hover {
    background: rgba(52, 152, 219, 1);
    transform: scale(1.1);
}

.help-nav-btn:active {
    transform: scale(0.95);
}

.help-image-indicator {
    font-size: 16px;
    color: #666;
    margin: 10px 0;
    font-weight: 500;
}

.help-image-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
}

.help-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.help-dot:hover {
    background: #999;
    transform: scale(1.2);
}

.help-dot.active {
    background: #3498db;
    transform: scale(1.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}